package cn.lili.controller.feign;

import cn.lili.modules.goods.client.CategoryClient;
import cn.lili.modules.goods.entity.dos.Category;
import cn.lili.modules.goods.entity.vos.CategoryBrandVO;
import cn.lili.modules.goods.entity.vos.CategoryVO;
import cn.lili.modules.goods.service.CategoryBrandService;
import cn.lili.modules.goods.service.CategoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商品分类feignclient
 *
 * @author Chopper
 * @version v1.0
 * 2021-12-07 06:08
 */
@RestController
@RequiredArgsConstructor
public class CategoryFeignController implements CategoryClient {

    private final CategoryService categoryService;

    private final CategoryBrandService categoryBrandService;

    @Override
    public List<Category> firstCategory() {
        return categoryService.firstCategory();
    }

    @Override
    public Category getById(String id) {
        return categoryService.getCategoryById(id);
    }

    @Override
    public List<Category> listByIdsOrderByLevel(List<String> asList) {
        return categoryService.listByIdsOrderByLevel(asList);
    }

    @Override
    public List<Category> listByIds(List<String> asList) {
        return categoryService.listByIds(asList);
    }

    @Override
    public Object getCategoryNameByIds(List<String> asList) {
        return categoryService.getCategoryNameByIds(asList);
    }

    @Override
    public List<CategoryBrandVO> getCategoryBrandList(String categoryId) {
        return categoryBrandService.getCategoryBrandList(categoryId);
    }

    @Override
    public List<CategoryVO> listAllChildren(String parentId) {
        return categoryService.listAllChildren(parentId);
    }
}
